package com.sz.controller.frame;

import com.sz.lucene.TikuIndex;
import com.sz.pojo.frame.Tiku;
import com.sz.service.frame.TikuService;
import com.sz.service.frame.ZiDianService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.List;

/**
 * 用户管理
 *
 * @author 哈尼玛
 */
@Controller
public class ZiDianController extends BaseController<Tiku> {
    /**
     * 对应pojo的名字
     */
    public static final String POJO_NAME = "zidian";
    /**
     * 权限url前缀
     */
    public static final String PERMISSION_URL_PREFIX = PERMISSION_PREFIX + POJO_NAME;
    /**
     * 列表
     */
    public static final String LIST_URL = PERMISSION_URL_PREFIX + "/list";
    public static final String MODIFY_URL = PERMISSION_URL_PREFIX + "/modify";
    public static final String SAVE_URL = PERMISSION_URL_PREFIX + "/save";
    public static final String SAVE_ALL_URL = PERMISSION_URL_PREFIX + "/saveall";
    public static final String REMOVE_URL = PERMISSION_URL_PREFIX + "/remove";

    @Autowired
    private TikuService tikuService;
    @Autowired
    private TikuIndex tikuIndex;
    @Autowired
    private HttpServletRequest httpServletRequest;
    @Autowired
    private ZiDianService ziDianService;

    public ZiDianController() {
        super(POJO_NAME);
    }

    @RequestMapping(SAVE_ALL_URL)
    @ResponseBody
    public String saveall() {
        try {
            List<String> list = Files.readAllLines(Paths.get(""), Charset.forName("utf8"));
        } catch (IOException e) {
            e.printStackTrace();
        }
        return null;
    }


    @Override
    public String modify(Model m, Long id) {
        return null;
    }

    @Override
    public String remove(Model m, String ids) {
        return null;
    }

    @Override
    public String save(Model m, Tiku tiku) {
        return null;
    }
}